<?php


namespace app\admin\model;
use think\Model;

class User extends Model
{
    public function getImageAttr($value)
    {
        return "http://localhost:8848/QDD/service/public/uploads/" . $value;
    }

    //设置当前模型对应的完整数据表名称
    protected  $table = 'user';
    public function addEmp($data)
    {
        $this->save($data);
    }
    public function getList($name){
//     return $this->select();
        session('username', $name);
        return $this->where('username',$name)->select();
    }
//    public function getList(){
//        return $this->with('user')->paginate(5);//取出用户列表
//    }
    public function getUser($no){
        return $this->where('user_id',$no)->find();
    }
    public function updateUser($data){
        return $this->isUpdate(true)->save($data);
    }

    public function getHead($name,$head){
        session('username', $name);
        return $this->where('username',$name)->update(['image' => $head]);
    }

}


